﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Ajouter un film
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <% Html.RenderPartial("../Layout/admin_menu"); %>
    <ul class="breadcrumb">
        <li><a href="/Admin/Films">Tous Les films</a> <span class="divider">&raquo;</span></li>
        <li><a href="/Admin/Films/Info/<%= Model.movieData[0].id %>">Fiche info</a> <span class="divider">&raquo;</span></li>
        <li class="active"><a href="/Admin/Films/Edit/<%= Model.movieData[0].id %>">Edition</a> <span class="divider">&raquo;</span></li>
    </ul>
    <h2>Editer un film</h2>
    <div class="container">
        <div class="row well">
            <h4>Informations générales</h4>
            <form class="form-horizontal pull-left" enctype="multipart/form-data"  action="/Admin/Films/Edit/<%= Model.movieData[0].id %>" method="post">
                <div class="control-group">
                    <label class="control-label">Titre</label>
                    <div class="controls">
                        <input type="text" name="title" value="<%= Model.movieData[0].title %>" />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">Durée</label>
                    <div class="controls">
                        <select name="length" class="input-small">
                            <% for (var i = 0; i <= 200; i++) { %>  
                            <option <% if (Model.movieData[0].length == i) {%> selected="selected" <%} %> value="<%= i %>"><%= i %></option>
                            <% } %>
                        </select> minutes
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">Année de sortie</label>
                    <div class="controls">
                        <select name="release_year">
                            <% for (var i = 1930; i <= 2013; i++) { %>
                            <option <% if (Model.movieData[0].release_year == i) {%> selected="selected" <%} %> value="<%= i %>"><%= i %></option>
                            <% } %>
                        </select>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">Résumé</label>
                    <div class="controls">
                        <textarea class="input-xxlarge" rows="5" name="resume"><%=  Html.Encode(Model.movieData[0].resume) %></textarea>
                    </div>
                </div>
                <div class="control-group">
                    <div class="controls">
                        <button class="btn btn-info" type="submit"><i class="icon-refresh icon-white"></i> Mettre a jour</button>
                    </div>
                </div>
            </form>
            <div class="form-horizontal pull-right">
                <img src="<%= Request.ApplicationPath + "Content/i/media/films/" + Model.movieData[0].cover %>" class="img-polaroid" style="height:150px;width:120px;" />
            </div>
        </div>
        <div class="row well">
            <h4>Uploader la cover</h4>
            <form class="form-inline"  enctype="multipart/form-data" action="/Admin/Films/UploadCover/<%= Model.movieData[0].id %>" method="post">
                <div class="control-group">
                    <div class="controls">        
                        <input name="uploadFile" type="file" />
                        <button class="btn btn-small btn-success" name="upload_cover"><i class="icon-white icon-upload"></i> Uploader</button>
                    </div>
                </div>
            </form>
        </div>
        <div class="row well span3">
            <h4>Classification du film</h4>
            <form class="form-inline"  action="/Admin/Films/Categorized/<%= Model.movieData[0].id %>" method="post">
                <div class="control-group">
                    <label class="control-label">Ajouter a la catégorie</label>  
                    <div class="controls">
                        <select name="categorie">
                        <% foreach (var cat in Model.getCategories()) { %>
                            <option value="<%= cat.id %>"><%= cat.lib %></option>
                        <% } %>
                        </select>
                        <button class="btn btn-small btn-primary" name="add_category"><i class="icon-white icon-plus"></i> Ajouter</button>
                    </div>                    
                </div>
            </form>
            <form class="form-inline"  action="/Admin/Films/Uncategorized/<%= Model.movieData[0].id %>" method="post">
                <div class="control-group">
                <div class="control-label">Supprimer de la catégorie</div>
                <div class="controls">        
                        <select name="categorie">
                        <% foreach (var cat in Model.getCategoriesForMovie(Model.movieData[0].id))
                           { %>
                            <option value="<%= cat.id %>"><%= cat.lib %></option>
                        <% } %>
                        </select>
                        <button class="btn btn-small btn-danger" name="del_category"><i class="icon-white icon-remove"></i> Supprimer</button>
                    </div>
                </div>
            </form>
        </div>
        <div class="row well span3">
            <h4>Réalisateurs</h4>
            <form class="form-inline"  action="/Admin/Films/Realized/<%= Model.movieData[0].id %>" method="post">
                <div class="control-group">
                    <label class="control-label">Ajouter un réalisateur</label>  
                    <div class="controls">
                        <select name="artiste">
                        <% foreach (var art in Model.getArtistes()) { %>
                            <option value="<%= art.id %>"><%= art.firstname + " " + art.lastname %></option>
                        <% } %>
                        </select>
                        <button class="btn btn-small btn-primary" name="add_real"><i class="icon-white icon-plus"></i> Ajouter</button>
                    </div>                    
                </div>
            </form>
            <form class="form-inline"  action="/Admin/Films/Unrealized/<%= Model.movieData[0].id %>" method="post">
                <div class="control-group">
                <div class="control-label">Supprimer un réalisateur</div>
                <div class="controls">        
                        <select name="categorie">
                        <% foreach (var cat in Model.getRealForMovie(Model.movieData[0].id))
                           { %>
                            <option value="<%= cat.id %>"><%= cat.firstname + " " + cat.lastname %></option>
                        <% } %>
                        </select>
                        <button class="btn btn-small btn-danger" name="del_real"><i class="icon-white icon-remove"></i> Supprimer</button>
                    </div>
                </div>
            </form>
        </div>
        <div class="row well span3">
            <h4>Acteurs</h4>
            <form class="form-inline"  action="/Admin/Films/Act/<%= Model.movieData[0].id %>" method="post">
                <div class="control-group">
                    <label class="control-label">Ajouter un acteur</label>  
                    <div class="controls">
                        <select name="artiste">
                        <% foreach (var art in Model.getArtistes()) { %>
                            <option value="<%= art.id %>"><%= art.firstname + " " + art.lastname %></option>
                        <% } %>
                        </select>
                        <button class="btn btn-small btn-primary" name="add_actor"><i class="icon-white icon-plus"></i> Ajouter</button>
                    </div>                    
                </div>
            </form>
            <form class="form-inline"  action="/Admin/Films/Unact/<%= Model.movieData[0].id %>" method="post">
                <div class="control-group">
                <div class="control-label">Supprimer un acteur</div>
                <div class="controls">        
                        <select name="categorie">
                        <% foreach (var cat in Model.getActorForMovie(Model.movieData[0].id))
                           { %>
                            <option value="<%= cat.id %>"><%= cat.firstname + " " + cat.lastname %></option>
                        <% } %>
                        </select>
                        <button class="btn btn-small btn-danger" name="del_actor"><i class="icon-white icon-remove"></i> Supprimer</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</asp:Content>
